<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Zabbix," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;使用Orabbix监控oracle数据库，发现可以实现对oracel数据库实行监控，但是    最近部署Orabbix监控oracle数据库，发现始终无法获取到数据库的内容。。。。。。由于Orabbix是基于java实现的，使用的是jdbc连接oracle数据库，获取到的值传递给zabbix捕捉器来捕捉">
<meta name="keywords" content="Zabbix">
<meta property="og:type" content="article">
<meta property="og:title" content="zabbix使用pyora监控oracle数据库">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/Zabbix/23. zabbix使用pyora监控oracle数据库/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;使用Orabbix监控oracle数据库，发现可以实现对oracel数据库实行监控，但是    最近部署Orabbix监控oracle数据库，发现始终无法获取到数据库的内容。。。。。。由于Orabbix是基于java实现的，使用的是jdbc连接oracle数据库，获取到的值传递给zabbix捕捉器来捕捉">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/01.jpeg?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/02.jpeg?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/03.jpeg?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/04.jpeg?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/05.jpeg?raw=true">
<meta property="og:updated_time" content="2017-09-02T17:39:39.177Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="zabbix使用pyora监控oracle数据库">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;使用Orabbix监控oracle数据库，发现可以实现对oracel数据库实行监控，但是    最近部署Orabbix监控oracle数据库，发现始终无法获取到数据库的内容。。。。。。由于Orabbix是基于java实现的，使用的是jdbc连接oracle数据库，获取到的值传递给zabbix捕捉器来捕捉">
<meta name="twitter:image" content="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/01.jpeg?raw=true">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/Zabbix/23. zabbix使用pyora监控oracle数据库/"/>





  <title>zabbix使用pyora监控oracle数据库 | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/Zabbix/23. zabbix使用pyora监控oracle数据库/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">zabbix使用pyora监控oracle数据库</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T02:13:44+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用Orabbix监控oracle数据库，发现可以实现对oracel数据库实行监控，但是    最近部署Orabbix监控oracle数据库，发现始终无法获取到数据库的内容。。。。。。由于Orabbix是基于java实现的，使用的是jdbc连接oracle数据库，获取到的值传递给zabbix捕捉器来捕捉，这个过程我不是很熟悉。。。。。。始终无法调试出图来。。。最后终于放弃，寻找Orabbix的替代品。在zabbix官网找了一遍，发现使用python实现的pyora这个脚本还不错，最大的优势就是能够自定义自己想监控的相关参数，只需要修改脚本，在里面添加相关函数就行。pyora是通过python使用python的一个组件cx_Oracle来获取的，获取到的数据传递给zabbix的agent，从而获取到相关监控数据，这种方式比较简单，也比较容易扩展。pyora的缺点就是本身提供的监控item比较少，而且提供的模板是一个半成品模板，需要自己根据需要设计相应的模板，从而达到监控的目的。总体来说，pyora的特点就是简单，开源，易扩展，但是整体做的不是很完整。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;首先，需要下载pyora，在zabbix官网上面找到的github的链接，链接在这<a href="https://github.com/bicofino/Pyora" target="_blank" rel="external">https://github.com/bicofino/Pyora</a> </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然而python需要安装cx_Oracle这个组件才能连接到数据库，安装cx_Oracle这个组件比较麻烦，搞了差不多两个多小时才搞定，开始使用源码安装，结果安装不上去。。。一直解决不了报错。。。于是去找了rpm包来安装，由于这里的oracle数据库的python版本是2.6的，所以下载了2.6对应的版本，并且这里支持的最新的oracle也只有11g，而我这里使用的是12c，当时还担心了好久，怕无法使用，后来证实11g的rpm包也是可以在12c的oracle数据库上面使用的，链接在这<a href="http://sourceforge.net/projects/cx-oracle/files/5.1.2/cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm/download" target="_blank" rel="external">http://sourceforge.net/projects/cx-oracle/files/5.1.2/cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm/download</a> 可以根据自己的需要下载相应的rpm包。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;还需要下载两个python的组件，一个是argparse，还有一个是setuptools这两个包都是到Python官网下载的。首先安装setuptools，然后再安装argparse，安装方式是使用源码安装，解压后进入目录，使用python setup.py install就可以安装了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;好了，前期准备工作做完了，接下来就需要安装cx_Oracle了，首先，在root用户下    的.bashrc中添加oracle的环境变量，否则将导致无法使用cx_Oracle模块，下面是在用    户中添加的环境变量：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">tail -6 .bashrc </div><div class="line"><span class="comment"># User specific aliases and functions</span></div><div class="line"><span class="built_in">export</span> ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome</div><div class="line"><span class="built_in">export</span> TNS_ADMIN=<span class="variable">$ORACLE_HOME</span>/network/admin</div><div class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:<span class="variable">$ORACLE_HOME</span>/bin:<span class="variable">$ORACLE_HOME</span>/lib:/lib:/usr/lib:<span class="variable">$ORACLE_HOME</span>/rdbms/lib</div><div class="line"><span class="built_in">export</span> LD_LIBRARY_PATH=<span class="variable">$ORACLE_HOME</span>/lib:/lib:/usr/lib:<span class="variable">$ORACLE_HOME</span>/rdbms/lib</div><div class="line"><span class="built_in">export</span> CLASSPATH=<span class="variable">$ORACLE_HOME</span>/JRE:<span class="variable">$ORACLE_HOME</span>/jlib:<span class="variable">$ORACLE_HOME</span>/rdbms/jlib</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加好环境变量之后，需要使其立即生效，使用命令source .bashrc来使其生效，注意<code>export     PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib</code>这条命令，刚开始的时候没有添加后面的lib的环境变量，导致安装好cx_Oracle    组件之后还是无法import这个组件，报错信息如下：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">error <span class="keyword">while</span> loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;后来，将环境变量中添加了lib库该报错就消失了。接下来就是安装cx_Oracle组建了，使用rpm -ivh cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm就可以安装了，安装好后使用下面的操作看是否能够正常的import，下面是我的操作步骤，如果你的和我的一样没有异常输出，那么就没问题的：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">python</div><div class="line">Python 2.6.6 (r266:84292, Jan 22 2014, 01:49:05) </div><div class="line">[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2</div><div class="line">Type <span class="string">"help"</span>, <span class="string">"copyright"</span>, <span class="string">"credits"</span> or <span class="string">"license"</span> <span class="keyword">for</span> more information.</div><div class="line">&gt;&gt;&gt; import cx_Oracle</div><div class="line">&gt;&gt;&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;安装好后就可以使用pyora脚本来获取值了，（PS:对了，在这之前，需要在oracle数据库中创建相应的监控用户）关于oracle数据库中添加相应的监控用户权限属于DBA的范畴了，我这里只会贴出一些参考的权限配置，相关配置各位可以和公司的DBA协商配置：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">CREATE USER ZABBIX IDENTIFIED BY 123456 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;</div><div class="line"> GRANT CONNECT TO ZABBIX;</div><div class="line"> GRANT RESOURCE TO ZABBIX;</div><div class="line"> ALTER USER ZABBIX DEFAULT ROLE ALL;</div><div class="line"> GRANT SELECT ANY TABLE TO ZABBIX;</div><div class="line"> GRANT CREATE SESSION TO ZABBIX;</div><div class="line"> GRANT SELECT ANY DICTIONARY TO ZABBIX;</div><div class="line"> GRANT UNLIMITED TABLESPACE TO ZABBIX;</div><div class="line"> GRANT SELECT ANY DICTIONARY TO ZABBIX;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;配置好环境后就可以使用pyora脚本实现监控oracle了，接下来需要执行pyora脚本来进行测试了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在下载的pyora压缩包中含有pyora.py脚本，将其上传至客户端服务器，然后使用python pyora.py –username zabbix –password 123456 –address 127.0.0.1 –database xxx show_users来测试是否能够获取到正常数据，下面是执行的结果：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&#123;<span class="string">"data"</span>: [&#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ANONYMOUS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"APPQOSSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ASYNC"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"AUDSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"DBSNMP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"DIP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMADMIN_INTERNAL"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMCATUSER"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMUSER"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"OJVMSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ORACLE_OCM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"OUTLN"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYNC"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSBACKUP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSDG"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSKM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSTEM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"WMSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"XDB"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"XS<span class="variable">$NULL</span>"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ZABBIX"</span>&#125;]&#125;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;获取的是json格式的数据，证明这个脚本是可以正常运行的，然后需要创建zabbix用户，然后再安装agnetd，然后修改zabbix用户的环境变量，编辑zabbix用户家目录下的.bashrc将上面的环境变量添加进去并source .bashrc使环境变量生效。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;之后再使用zabbix用户重复一次执行上面的获取数据的步骤，测试能够获取数据的话就说明没问题了，在agentd的配置文件中写入如下配置，以执行这个脚本获取到监控的数据：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">tail -2 /home/zabbix/zabbix/etc/zabbix_agentd.conf</div><div class="line">UserParameter=pyora[*],/usr/bin/python /home/zabbix/zabbix/scripts/pyora.py --username <span class="variable">$1</span> --password <span class="variable">$2</span> --address <span class="variable">$3</span> --database <span class="variable">$4</span> <span class="variable">$5</span> <span class="variable">$6</span> <span class="variable">$7</span> <span class="variable">$8</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;保存后重启agentd，然后再在server端使用zabbix_get测试能否获取到数据，测试结果如下：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">/opt/software/zabbix/bin/zabbix_get -s xx.xx.xx.xx -k<span class="string">"pyora[zabbix,123456,127.0.0.1,xxx,show_users]"</span></div><div class="line">&#123;<span class="string">"data"</span>: [&#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ANONYMOUS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"APPQOSSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ASYNC"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"AUDSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"DBSNMP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"DIP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMADMIN_INTERNAL"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMCATUSER"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"GSMUSER"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"OJVMSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ORACLE_OCM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"OUTLN"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYNC"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSBACKUP"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSDG"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSKM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"SYSTEM"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"WMSYS"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"XDB"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"XS<span class="variable">$NULL</span>"</span>&#125;, &#123;<span class="string">"&#123;#DBUSER&#125;"</span>: <span class="string">"ZABBIX"</span>&#125;]&#125;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;证明没有问题了，然后需要在zabbix_server的web端添加模板，这个模板在下载的pyora压缩包里面有一个半成品的模板，这个模板是个不完整的半成品，需要自己完成剩下的配置我这里稍后也会打包放上我这边进行部分修改后的模板上来。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加主机并添加模板，这时候需要注意，因为这个模板中使用了宏变量，所以在添加主机的时候需要设定相应的宏变量，下面是设定宏变量的截图：</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/01.jpeg?raw=true" alt=""></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;设定好宏之后，等待一段时间（ps:一般5到十分钟就能够正常的产生数据了），下面是获取到的监控数据的截图：</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/02.jpeg?raw=true" alt=""></p>
<p><img src="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/03.jpeg?raw=true" alt=""></p>
<p><img src="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/04.jpeg?raw=true" alt=""></p>
<p><img src="https://github.com/hcldirgit/image/blob/master/zabbix%E4%BD%BF%E7%94%A8pyora%E7%9B%91%E6%8E%A7oracle%E6%95%B0%E6%8D%AE%E5%BA%93/05.jpeg?raw=true" alt=""></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;好了，至此，简单的oracle监控已经结束了，至于更多的监控需求，各位可以依据自己的需求进行适当的修改脚本，以达到各位的要求。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Zabbix/" rel="tag"># Zabbix</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/Zabbix/22. zabbix使用percona zabbix mysql-plugin监控mysql数据库/" rel="next" title="zabbix使用percona zabbix mysql-plugin监控mysql数据库">
                <i class="fa fa-chevron-left"></i> zabbix使用percona zabbix mysql-plugin监控mysql数据库
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/Zabbix/24. zabbix通过JMX监控tomcat状态/" rel="prev" title="zabbix通过JMX监控tomcat状态">
                zabbix通过JMX监控tomcat状态 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      

      <section class="site-overview sidebar-panel sidebar-panel-active">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
